package com.jta.service.impl;


import java.util.List;


import javax.annotation.Resource;


import com.jta.beans.HisTest;
import com.jta.beans.TmsTest;
import com.jta.dao.intf.IBaseDao;
import com.jta.service.intf.IBaseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;




@Service
@Transactional(propagation=Propagation.REQUIRED)
public class BaseServiceImpl implements IBaseService {

    @Resource
    private IBaseDao tmsDao;
    @Resource
    private IBaseDao hisDao;

    @SuppressWarnings("rawtypes")
    @Override
    public List findTms() throws Exception {
        /*DataSourceContextHolder.setDataSourceType(DataSourceConst.TMS_STRING);
        String hql = "from MedicalCard";
        return tmsDao.findAll(hql);*/
        String hql = "FROM TmsTest";
        return tmsDao.findAll(hql);
    }

    @SuppressWarnings("rawtypes")
    public List findHis() throws Exception{
        /*DataSourceContextHolder.setDataSourceType(DataSourceConst.HIS_STRING);
        String hql = "from Patient where idNo = ?";
        return hisDao.query(hql, idNo);*/
        String hql = "FROM HisTest";
        return hisDao.findAll(hql);
    }


    @Override
    public void save(TmsTest tms, HisTest his) throws Exception {
        tmsDao.save(tms);
        hisDao.save(his);
    }


}
